<?php
if(stristr($_SERVER['PHP_SELF'],".inc.php")) { 
	header("Location:index.php"); 
	exit; 
}
?>
	<hr class="simple" />
	<a name="add">&nbsp;</a>
	<form action="<?php echo $self; ?>" method="POST" name="myform">
	<div id="add_item">
		<div id="add_item_header"><?php echo $Lang['add'] . " " . $Lang['post']; ?></div>
	
	<div id="add_item_title">
		<input class="item_title" type="text" value="<?=htmlspecialchars(stripslashes($_POST['title']));?>" name="title" maxlength="100" id="id_item_title" />
	</div>
	<fieldset id="add_item_teaser">
		<legend><?=ucwords($Lang['teaser']);?></legend>
		<textarea name="teaser" id="teaser"><?= htmlspecialchars(stripslashes($_POST['teaser'])); ?></textarea>
		<br />
		<input type="button" class="button" value="Bold" name="b" onclick="boldify2('teaser')">&nbsp;
		<input type="button" class="button" value="Italic" name="i" onclick="italify2('teaser')">&nbsp;
		<input type="button" class="button" value="Underline" name="u" onclick="underlinify2('teaser')">&nbsp;
		<input type="button" class="button" value="Insert Link" name="href" onclick="linkify2('teaser')">&nbsp;
		<input type="button" class="button" value="Insert Image" name="img" onclick="imagify2('teaser')">
	</fieldset>
	
	<div id="add_item_body_collapsed" style="display:block;">
		<input type="button" onclick="javascript:toggle_body()" class="button" value="Show Body" />
	</div>
	<fieldset id="add_item_body" style="display:none">
		<legend><?=ucwords($Lang['post']);?></legend>
		<textarea name="post" id="post" cols="50" rows="10"><?= htmlspecialchars(stripslashes($_POST['post'])); ?></textarea>
		<br/><input type="button" class="button" value="Bold" name="b" onclick="boldify2('post')">&nbsp;
		<input type="button" class="button" value="Italic" name="i" onclick="italify2('post')">&nbsp;
		<input type="button" class="button" value="Underline" name="u" onclick="underlinify2('post')">&nbsp;
		<input type="button" class="button" value="Insert Link" name="href" onclick="linkify2('post')">&nbsp;
		<input type="button" class="button" value="Insert Image" name="img" onclick="imagify2('post')"><br />
		<br />
		<input type="button" onclick="javascript:toggle_body()" class="button" value="Hide Body" />
	</fieldset>	

	<fieldset id="metadata">
		<legend><?=ucwords($Lang['metadata']);?></legend>
		<?php echo ucwords($Lang['topic']); ?><br />
		<select name="topic">
<?php
	foreach($topics as $k=>$v) { 
		echo "\t\t<option value=\"".$v['topicid']."\">".$v['name']."</option>\n";
	}
?>	
		</select>
		<br /><br />
	<?php echo ucwords($Lang['tags']); ?>: <input id="tags" name="tags" type="text" value="<?=$_POST['tags'];?>" size="40">
		<br /><small>Tags should be separated by a comma</small>
	</fieldset>
	<div id="placeholder"></div>

	<fieldset id="add_item_slug">
		<legend><?php echo ucwords($Lang['slug']); ?></legend>
		<input class="item_slug"  id="id_item_slug" type="text" value="<?=urlify($_POST['slug']);?>" name="slug" size="40" maxlength="55" /> <input type="button" onclick="javascript:mkSlug();" value="Suggest Slug Title" /> 
	</fieldset>
	
	<fieldset id="add_item_pubdate">
		<legend><?php echo ucwords($Lang['pubdate']); ?></legend>
		<input id="pubdate" name="pubdate" type="text" value="<?php echo date("Y-m-d G:i:s"); ?>" size="25">
		<a href="javascript:NewCal('pubdate','YYYYMMDD',true)">
		<img src="./inc/datetime/cal.gif" width="16" height="16" border="0" alt="Pick a date" /></a>
	</fieldset>
		
	<fieldset id="add_item_public">
		<legend><?php echo ucwords($Lang['public']); ?></legend>
		<input type="radio" name="public" value="1" checked="checked"><?php echo $Lang['unhideThisPost']; ?>
		<input type="radio" name="public" value="0"><?php echo $Lang['hideThisPost']; ?>
		</select>
	</fieldset>

	<div id="add_item_buttons">
		<input type="submit" name="preview" class="button" VALUE="<?php echo $Lang['preview']. " " . $Lang['post']; ?>" />
		&nbsp;&nbsp;
		<input type="submit" name="add" class="button" value="<?php echo $Lang['add'] . " " . $Lang['post']; ?>" />
	</div>

	</div>
	</form> 